﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.Xml;
namespace _MetalSlug
{
    public abstract class VisibleGameEntity : GameEntity
    {
        List<MySprite> sprites;
        private int nSpirtes;
        public int NSpirtes
        {
            get { return nSpirtes; }
            set { nSpirtes = value; }
        }
        private Vector2 topLeft;
        public Vector2 TopLeft
        {
            get { return topLeft; }
            set 
            { topLeft = value; }
        }
        private Vector2 size;
        public Vector2 Size
        {
            get { return size; }
            set { size = value; }
        }

        public List<MySprite> Sprites
        {
            get { return sprites; }
            set { sprites = value; }
        }

        virtual public void Update (GameTime gameTime)
        {
            for (int i = 0; i < nSpirtes; i++)
            {
                Sprites[i].Update(gameTime);
            }
        }

        virtual public void Draw (SpriteBatch spriteBatch)
        {
            for (int i = 0 ; i <nSpirtes ;i++)
            {
                Sprites[i].Draw(spriteBatch);
            }
        }

     

        virtual public bool IsClicked(Vector2 point)
        {
            if( (point.X >= TopLeft.X) && (point.X <= TopLeft.X + Size.X) &&
                (point.Y >= TopLeft.Y) && (point.Y<= TopLeft.X + Size.Y) )
                return true; 
            return false;
        }

       

    }
}
